home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
fortran-to-c-translator-11
/
Mac F2C 1.1
/
Mac F2C Documentation
/
Mac F2C AppleEvents
/
Mac F2C AppleEvents Info
next >
Wrap
Text File
|
1995-01-13
|
10KB
|
235 lines
**************************************
**************************************
APPLE EVENTS AND Mac F2C v1.1
**************************************
**************************************
** INTRODUCTION AND QUICK-START **
Mac F2C is Apple Event savvy. It support drag-&-drop translation. More
importantly, you can drive Mac F2C translations entirely using Apple
Events. Mac F2C provides two different specialized translation events.
One (the 'f2c' event allows you to pass option choices in a UNIX-style
option string (see "UNIX f2c Option Switch Syntax" for more information on
the UNIX-style switches). The other (the 'translate' event) lets you pass
option choices just like you would in the various options dialog. They
also differ in that you can pass a list of files to the first, but only a
single file to the second. Which you use is purely a matter of personal
choice.
Two sample Apple Scripts are enclosed. They were written using v1.1 of the
AppleScriptâ„¢ extension and v1.1 of the AppleScript Editor. The script
"Sample Mac F2C Script 1" illustrates how to use the 'f2c' event. The
script "Sample Mac F2C Script 2" illustrates how to use the 'translate'
event. If you use AppleScript, simply modify these scripts to meet your
needs. Mac F2C includes a full 'aete' resource, so its dictionary
provides detailed information on the exact syntax of the Apple Events
supported by Mac F2C.
The remainder of this document provides more detailed information for users
who wish to know more about the Mac F2C Apple Events. In particular, the
information below has all the information needed to write code that sends
Apple Events to Mac F2C.
** Mac F2C APPLE EVENTS: THE DETAILS **
REQUIRED APPLE EVENTS
Mac F2C supports the four required Apple Events: open application, open
documents, print documents, and quit application. These events behave as
follows:
- open application: No unique actions are performed.
- open documents: Documents listed are translated into C using the
default options settings. An error message is
issued if the document name does not end in '.f' or
'.F'. An open event is equivalent to a 'translate'
event (see below) with no optional parameters.
- print documents: Silently ignored; Mac F2C does not print anything.
- quit application: Quits Mac F2C.
Note that Mac F2C does not own any files (i.e., there are no files of type
Mac F2C except for the application itself). The open event is used to
support drag-&-drop operation. This allows you to translate a bunch of
FORTRAN files by dragging them and dropping them on top of Mac F2C.
THE Mac F2C SUITE
The Mac F2C Suite is a set of Apple events that can be used to control the
translation of FORTRAN files to C files. The Mac F2C suite consists of two
events differing in how options are passed to the f2c kernel. The first
event mimics the operation of the original f2c program on UNIX machines.
Options for the f2c kernel are passed as a single string of UNIX-style
option settings. The second event mimics the operation of Mac F2C.
Options for the f2c kernel are passed by specifying the values of the
check-boxes, radio-buttons, and edit-fields found in the various Mac F2C
option dialogs.
These two events are:
Name Requested Action
---- ----------------
f2c Translate the specified files (one or more) from
FORTRAN to C using a UNIX-style string of options.
translate Translate the specified file (only one) from FORTRAN
to C setting options by setting choices in the options
dialogs.
More detailed event descriptions follow:
f2c
~~~
This event will have Mac F2C translate one or more FORTRAN files. The
options for the f2c kernel are specified by a UNIX-style set of switches
(e.g. "-A -P -w -f"; see "UNIX f2c Option Switch Syntax" for more
information on the switches and their meaning).
Event Class: kF2CEventClass
Event ID: kAEf2cEvent
Parameters:
keyDirectObject typeAEList (elements the list of FORTRAN files
are typeAlias) to translate
keyUnixCmdStr typeChar a UNIX-style option string
keyCreatorOption typeType the creator OSType for output
files
keyThinkOption typeBoolean touch the corresponding THINK
project file?
keyCWOption typeBoolean touch the corresponding
CodeWarrior project file?
keyMakeOption typeBoolean send THINK/CodeWarrior a
make command after
translation?
Reply Parameters:
keyAEResult typeAEList (elements the return code from the f2c
are typeInteger kernel, one per file translated
keyErrorNumber typeLongInteger error code if Mac F2C was unable
to _process_ your event; not
provided if no _processing_
errors occur. Compile results
(including compile errors) are
returned in keyAEResult
keyErrorString typeChar an error message whenever
keyErrorNumber is non-zero
translate
~~~~~~~~~
This event will have Mac F2C translate one FORTRAN file. The options for
the f2c kernel are specified by lists of settings corresponding to each of
the options dialogs in Mac F2C. Radio-buttons and check-boxes are set by
boolean values (true means selected or checked, false means unselected or
unchecked). Edit-fields are set by short integer values.
Event Class: kF2CEventClass
Event ID: kAETranslateEvent
Parameters:
keyDirectObject typeAlias the FORTRAN file to translate
keyFortranOptions typeAEList (elements the settings of the FORTRAN
are typeBoolean) Options dialog check-boxes
keyCOptions typeAEList (elements the settings of the C Options
are typeBoolean) dialog radio-buttons and
check-boxes
keyProtoOptions typeAEList (elements the settings of the Prototyping
are typeBoolean) Options dialog check-boxes
keyWarnOptions typeAEList (elements the settings of the Warning
are typeBoolean) Options dialog check-boxes
keyAdvancedOptions typeAEList (elements the numbers in the Advanced
are typeShortInteger) Options edit-text fields
keyUnixOptions typeChar a UNIX-style option string to
be appended after all other
options are processed
keyCreatorOption typeType the creator OSType for output
files
keyThinkOption typeBoolean touch the corresponding
THINK project file?
keyCWOption typeBoolean touch the corresponding
CodeWarrior project file?
keyMakeOption typeBoolean send THINK/CodeWarrior a
'make' command after
translation?
Reply Parameters:
keyAEResult typeInteger the return code from the f2c
kernel
keyErrorNumber typeLongInteger error code if Mac F2C was unable
to _process_ your event; not
provided if no _processing_
errors occur. Compile results
(including compile errors) are
returned in keyAEResult
keyErrorString typeChar an error message whenever
keyErrorNumber is non-zero
Mac F2C Constants
~~~~~~~~~~~~~~~~~
The following constants are used by the Mac F2C suite. They also appear in
the file "MacF2C_AEConstants.h".
kF2CEventClass 'F2Ci'
kAETranslateEvent 'F2C1'
kAEf2cEvent 'F2C2'
keyFortranOptions 'F2Cf'
keyCOptions 'F2Cc'
keyProtoOptions 'F2Cp'
keyWarnOptions 'F2Cw'
keyAdvancedOptions 'F2Cn'
keyUnixOptions 'F2Cu'
keyUnixCmdStr 'F2Cs'
keyCreatorOption 'F2Ct'
keyThinkOption 'F2CT'
keyCWOption 'F2CC'
keyMakeOption 'F2Cr'